﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyDoanVien.General;
using QuanLyDoanVien.Controller;
using QuanLyDoanVien.Bussiness;

namespace QuanLyDoanVien.Report
{
    public partial class frmXuatHocSinhSaiPham : Form
    {
        LopCtrl m_LopCtrl = new LopCtrl();
        KyLuatCtrl m_KyLuatCtrl = new KyLuatCtrl();
        HocSinhViPhamCtrl m_HocSinhViPhamCtrl = new HocSinhViPhamCtrl();
        DataTable dshsvp = new DataTable();
        String[] dsvp;
        public frmXuatHocSinhSaiPham()
        {
            InitializeComponent();
            DataService.OpenConnection();
        }
        private void Load_DS_HS_SaiPham()
        {
            int i = 0;
            if (this.lstViPham.SelectedItems.Count <= 0)
                return;
            dsvp = new String[lstViPham.SelectedItems.Count];
            foreach (KyLuatInfo kl in this.lstViPham.SelectedItems)
            {
                dsvp[i] = kl.MaKyLuat;
                i++;
            }
            if (this.lstViPham.SelectedItems.Count > 0)
            {
                dshsvp = m_HocSinhViPhamCtrl.LayHocSinhViPham1(dsvp, this.cmbLop.SelectedValue.ToString());
                this.hocSinhViPhamBindingSource.DataSource = dshsvp;
                this.reportViewer1.RefreshReport();
            }
 
        }

        private void frmXuatHocSinhSaiPham_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'quanLyDoanVienDataSet.Tab_HocSinhViPham' table. You can move, or remove it, as needed.
           // this.tab_HocSinhViPhamTableAdapter.Fill(this.quanLyDoanVienDataSet.Tab_HocSinhViPham);
            // TODO: This line of code loads data into the 'quanLyDoanVienDataSet.Tab_HocSinhViPham' table. You can move, or remove it, as needed.
            //this.tab_HocSinhViPhamTableAdapter.Fill(this.quanLyDoanVienDataSet.Tab_HocSinhViPham);
            m_LopCtrl.HienThiComboBox(this.cmbLop);
           // m_KyLuatCtrl.HienThiComboBox(this.cmbViPham);
            m_KyLuatCtrl.HienThiListBox(this.lstViPham);
            Load_DS_HS_SaiPham();
            this.reportViewer1.RefreshReport();
        }

        private void cmbLop_SelectedIndexChanged(object sender, EventArgs e)
        {


        }

        private void hocSinhViPhamBindingSource1_CurrentChanged(object sender, EventArgs e)
        {

        }

        private void btn_Tim_HSVP_Click(object sender, EventArgs e)
        {
            Load_DS_HS_SaiPham();
        }

       
    }
}
